﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;

namespace PlanningGIS.ManageUtility
{
    /// <summary>
    /// 菜单项(按钮)风格（菜单项(按钮)上显示的内容）
    /// </summary>
    [Description("按钮风格")]
    public enum eButtonStyle
    {
        /// <summary>
        /// 图标和文字
        /// </summary>
        [Description("图标和文字")]
        ImageAndText,
        /// <summary>
        /// 图标
        /// </summary>
        [Description("图标")]
        Image,
        /// <summary>
        /// 文字
        /// </summary>
        [Description("文字")]
        Text

    }

    /// <summary>
    /// 图标显示位置
    /// </summary>
    public enum eImagePosition
    {
        /// <summary>
        /// 
        /// </summary>
        Left,
        /// <summary>
        /// 
        /// </summary>
        Right,
        /// <summary>
        /// 
        /// </summary>
        Top,
        /// <summary>
        /// 
        /// </summary>
        Bottom
    }

    /// <summary>
    /// 权限组类
    /// </summary>
    public interface IPrivilegeGroup : IPrivilegeElement
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="child"></param>
        void AddChild(IPrivilegeElement child);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="child"></param>
        void RemoveChild(IPrivilegeElement child);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        List<IPrivilegeElement> GetChilds();
    }

    /// <summary>
    /// 权限项类,可以为一个Button，也可以为包含一些Button的Group
    /// </summary>
    public interface IPrivilegeElement
    {
        /// <summary>
        /// 菜单项(按钮)的显示文本
        /// </summary>
        string Text { get; set; }

        /// <summary>
        /// 
        /// </summary>
        string NakedText { get; }

        /// <summary>
        /// 功能类的类型名
        /// </summary>
        string TypeName { get; set; }

        /// <summary>
        /// 按钮显示风格(文字和图标、文字、图标)
        /// </summary>
        eButtonStyle ButtonStyle { get; set; }

        /// <summary>
        /// 固定图标大小(32*32 或 16*16)
        /// </summary>
        Size ImageFixedSize { get; set; }

        /// <summary>
        ///图标显示位置
        /// </summary>
        eImagePosition ImagePosition { get; set; }

        /// <summary>
        /// 权限项对应的xml
        /// </summary>
        string Xml { get; }

        /// <summary>
        /// 菜单项(按钮)是否可见/可用
        /// </summary>
        bool Enable { get; set; }

        /// <summary>
        /// 菜单项(按钮)是否分组
        /// </summary>
        bool BeginGroup { get; set; }

        /// <summary>
        /// 菜单项(按钮)是否垂直显示
        /// </summary>
        bool VerticalShow { get; set; }

        /// <summary>
        /// 
        /// </summary>
        string KeyTips { get; set; }

        /// <summary>
        /// 获取唯一标识的名称
        /// </summary>
        /// <returns></returns>
        string GetKeyName();

    }

    /// <summary>
    /// Xml与对象对应的节点、属性名称
    /// </summary>
    public class PrivilegeXMLTag
    {
        /// <summary>
        /// 菜单
        /// </summary>
        public const string GROUPTAG = "group";

        /// <summary>
        /// 功能点
        /// </summary>
        public const string PRIVILEGETAG = "privilegetag";

        /// <summary>
        /// 名称
        /// </summary>
        public const string NAME = "name";

        /// <summary>
        /// typename
        /// </summary>
        public const string TYPE = "typename";

        /// <summary>
        /// enable
        /// </summary>
        public const string Enable = "enable";

        /// <summary>
        /// begingroup
        /// </summary>
        public const string BeginGroup = "begingroup";

        /// <summary>
        /// buttonstyle
        /// </summary>
        public const string ButtonStyle = "buttonstyle";

        /// <summary>
        /// imagefixedsize
        /// </summary>
        public const string ImageFixedSize = "imagefixedsize";

        /// <summary>
        /// imageposition
        /// </summary>
        public const string ImagePosition = "imageposition";

        /// <summary>
        /// verticalshow
        /// </summary>
        public const string VerticalShow = "verticalshow";

        /// <summary>
        /// keytips
        /// </summary>
        public const string KeyTips = "keytips";
    }
}
